//
//  BaseVisitorsTabVc.swift
//  Weibo
//
//  Created by rzj on 16/3/10.
//  Copyright © 2016年 rzj. All rights reserved.
//

import UIKit

class BaseVisitorsTabVc: UITableViewController {

    //是否登录成功
    var loginSuccess:Bool = false
    
    //作为控制器的父类 控制如何显示view
    override func loadView() {
        
        if loginSuccess {
        
            //显示界面
            super.loadView()
        
        }else {
        
            //加载访客视图
            loadVisitorsVc()
        }
        
    }
    
    //加载访客视图
    private func loadVisitorsVc() {
        view = visitorsView
        navigationItem.leftBarButtonItem = UIBarButtonItem(imgName: nil, title: "注册", target: self, action: "itemOnlick")
        navigationItem.rightBarButtonItem = UIBarButtonItem(imgName: nil, title: "登录", target: self, action: "itemOnlick")
    }
    
    @objc private func itemOnlickLogin() {
        
        print("itemOnlick")
    }
    
    /**  供外界调用其对象方法 */
    lazy var visitorsView:VisitorsView = {
        let v = VisitorsView()
        v.delegate = self
        return v
    
    }()
 
}


extension BaseVisitorsTabVc:VisitorsViewDelegate {

    func visitorsView(visitorsView: VisitorsView, btnClickLogin: UIButton) {
        
        itemOnlickLogin()
    }

}




